import java.io.*;
import java.lang.*;

class h
{
    public static void main(String [] args)
    {
        String ipaddr;          // from command line
        String infile;          // from command line
        FileInputStream fstream;          // will be used to read files later
        DataInputStream in;
        BufferedReader br;
        String line;                    // contains a line read from the buffer
        String s;                       // temp string
        int pos;
        
        // arguments arent correct
        if (args.length != 2)
        {
            System.out.println("Usage: java h <infile> <ip>");
            System.exit(-1);
        }
        else
        {
            // arguments are correct - extract the values
            // ipaddr is the ip you want to use to create the output hosts entry
            // infile is the file that contains the hosts pasted from MUI
            infile = args[0];
            ipaddr = args[1];   
            
            try
            {
                // setup the new input streams to read the file provided
                fstream = new FileInputStream(infile);
                in = new DataInputStream(fstream);
                br = new BufferedReader(new InputStreamReader(in));
                
                // start reading line by line until EOF
                while ((line = br.readLine()) != null)
                {                    
                    // Parse the line
                    // typical line:   <host exact="true">content.stage.static.nfl.com</host>
                    // - do a find-replace for </host>
                    // - count from > to end of line
                    // - cannot do a file-replace for <host exact="true"> because copy-paste doesnt work properly and it might not get copied fully
                    
                    s = line;
                    s = s.trim();       // remove junk white spaces from end/beginning
                    s = s.replace("</host>","");
                    pos = s.indexOf(">");
                    s = s.substring(pos+1);     // from > till end of line
                    
                    System.out.println(ipaddr + "\t\t" + s);
                    
                } // end while
            
            } // end try
            catch (Exception e)
            {
                System.err.println("Error: " + e.getMessage());
                
            } // end catch
            
        } // end else        
        
    } // end main
    
} // end class